import React, { Component } from 'react';
import * as service from '../api/index'
import '../styles/Nav.scss'
class Nav extends Component {
    constructor(props) {
        super(props);
        this.state = {
            list: []
        }
    }
    async componentDidMount() {
        let res = await service.index_nav()
        this.setState({ list: res.data.list })
    }
    render() {
        return (
            <div className='nav'>
                <div className='banner'> 轮播图占位</div>
                <div className='list'>
                    {
                        this.state.list.map((item,index)=>{
                            return (
                                <div className="item">
                                    <img src={item.pic} alt="" />
                                    <div className="text">{item.name}</div>
                                </div>
                            )
                        })
                    }
                </div>
                <div className='gitbanner'> 小图占位</div>
            </div>
        );
    }
}

export default Nav;